﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KS.DataWrapper.DataWrapper
{
    public partial class DataCacheObject<T> 
    {
        private async Task SignalRCollectionUpdateNotify(T item)
        {
            if (this.signalR != null)
            {
                 try
                {
                await this.signalR.CollectionUpdate(new List<string>() { item.ID }, typeof(T).Name);
                }
                 catch { }
            }
        }

        private async Task SignalRCollectionAddNotify(T item)
        {
            if (this.signalR != null)
            {
                try
                {
                    await this.signalR.CollectionAdd(new List<string>() { item.ID }, typeof(T).Name);
                }
                catch {}
            }
        }

        private async Task SignalRCollectionRemoveNotify(T item)
        {
            if (this.signalR != null)
            {
                try
                {
                await this.signalR.CollectionRemove(new List<string>() { item.ID }, typeof(T).Name);
                }
                catch {}
            }
        }
      
    }
}
